<?php

namespace App\Model\Scopes;

use Hyperf\Database\Model\Builder;
use Hyperf\Database\Model\Model;
use Hyperf\Database\Model\Scope;

class IsDeletedScope implements Scope
{
    protected int $isDeleted;

    public function __construct($isDeleted)
    {
        $this->isDeleted = $isDeleted;
    }

    public function apply(Builder $builder, Model $model): void
    {
        $builder->where("is_deleted", $this->isDeleted);
    }
}